package Commandes;

import Composite.Element;
import fichiers.*;
import java.io.File;
import javax.swing.JOptionPane;

public class Commande_RenommerPicasial implements Commande {

    private Element e;
    private String nom;
    private String ancienNom;

    public Commande_RenommerPicasial(Element e, String nom) {

        this.e = e;
        this.nom = nom;
        this.ancienNom = "";

    }

    public boolean execute() {

                this.ancienNom = new String(e.toString());
                e.setNom(nom);

           return true;
    }

    public boolean cancel() {


                 String temp = nom;
                 this.e.setNom(this.ancienNom);              
                 this.nom = new String(nom);
                 this.ancienNom = temp;
            

           return true;
    }

    public String getNomCommande() {
        return new String(" ( Renommer: " + ancienNom + " ) ");
    }
}
 
